#include<iostream>
using namespace std;
int main()
{
	int n;
	cin >> n;
	while (n--)
	{
		int m;
		cin >> m;
		cout << 2 * m * m - m + 1 << endl;
	}
	return 0;
}